package com.kaifamiao.wendao.service;

import com.kaifamiao.wendao.dao.CTRDao;
import com.kaifamiao.wendao.entity.Level;
import com.kaifamiao.wendao.entity.Topic;

import java.util.ArrayList;
import java.util.List;

public class CTRservice {
    CTRDao ctrDao=new CTRDao();
    TopicService topicService=new TopicService();

    public boolean save(Long cid,Long tid){
        return ctrDao.save(cid,tid);
    }

    public List<Topic> load(Long id){
        List<Long> list= ctrDao.loadAll(id);
        List<Topic> topicList=new ArrayList<>();
        for (Long aLong : list) {
            topicList.add(topicService.load(aLong));
        }
        return topicList;
    }

    public boolean remove(Long cid,Long tid){
        return ctrDao.remove(cid,tid);
    }
}
